import Vue from 'vue'
import App from './App.vue'
import './registerServiceWorker'
import apiPath from "@/settings"
import router from './router'
import vuetify from '@/plugins/vuetify';
import  axios from 'axios'
import store from './store'
axios.defaults.baseURL =apiPath

axios.interceptors.request.use(config => {
  console.log(config)
  //请求前添加Token
  config.headers.Authorization = window.sessionStorage.getItem('token')
  return config
})


Vue.prototype.$http= axios

Vue.filter('dateFormat', function (val) {
  let dt = new Date(val)
  let y = dt.getFullYear()
  let m = (dt.getMonth() + 1 + '').padStart(2, '0')
  let d = (dt.getDate() + '').padStart(2, 0)
  let hh = (dt.getHours() + '').padStart(2, 0)
  let mm = (dt.getMinutes() + '').padStart(2, 0)
  let ss = (dt.getSeconds() + '').padStart(2, 0)
  return `${y}-${m}-${d} ${hh}:${mm}:${ss}`
})



Vue.config.productionTip = false

new Vue({
  router,
  vuetify,
  store,
  render: h => h(App)
}).$mount('#app')
